package cn.jiangjiesheng.bootstrap.integration.testcase;

import cn.jiangjiesheng.bootstrap.integration.audit.annotation.RequestAuditing;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

@Slf4j
@RestController
@RequestMapping("/auditing")
public class AuditingDemoController {

    @PostMapping("/datawrite")
    @RequestAuditing(tag = "示例标签")
    public JSONObject datawrite(@RequestBody JSONObject jsonObject) {
        return new JSONObject(new HashMap<String, Object>() {{
            put("name", "zhangsaan");
            put("age", 22);
        }});
    }

}
